package com.maimao.api.sys;

import com.maimao.core.model.resp.Result;
import com.maimao.model.user.sys.Department;
import io.swagger.annotations.*;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2020/12/3 7:54 下午
 */
@Api(value="后台部门管理接口")
@RequestMapping("/sys/department")
public interface DepartmentApi {

    /**
     * 部门树形数据
     * @return
     */
    @ApiOperation("部门树形数据")
    @GetMapping("/treeData")
    Result<?> getDepartmentTree();

    @ApiOperation("父部门的直接子数据")
    @GetMapping("/by-parent")
    Result<?> getChild1(@RequestParam("parentId")Integer parentId);


    @ApiOperation("添加部门")
    @ApiImplicitParam(name="department",value = "部门实体",required=true)
    @PostMapping("/add")
    Result<?> addDepartment(@RequestBody Department department, BindingResult bindingResult);

    @ApiOperation("修改部门")
    @ApiImplicitParam(name="department",value = "部门实体",required=true)
    @PostMapping("/update")
    Result<?> updateDepartment(@RequestBody Department department, BindingResult bindingResult);

}
